package cn.edu.scau.cmi.zhouxinyue.AbsFactory;

import javafx.fxml.FXML;

import javafx.scene.control.Button;

import javafx.scene.control.MenuItem;

import javafx.scene.control.TextArea;

import javafx.scene.control.MenuButton;

public class AbsFactoryController {
	@FXML
	private TextArea MInfo;
	@FXML
	private MenuButton Brand;
	@FXML
	private MenuItem Aonong;
	@FXML
	private MenuItem Tianbang;
	@FXML
	private MenuItem Wens;
	@FXML
	private MenuButton Meat;
	@FXML
	private MenuItem B;
	@FXML
	private MenuItem C;
	@FXML
	private MenuItem P;
	@FXML
	private Button Start;
	private static int b=0;
	private static int m=0;
	private static String brand;
	private static String meat;
	public void ChooseAonong() {
		Brand.setText(Aonong.getText());
		b=1;
	}
	public void ChooseTianbang() {
		Brand.setText(Tianbang.getText());
		b=2;
	}
	public void ChooseWens() {
		Brand.setText(Wens.getText());
		b=3;
	}
	public void ChooseBeef() {
		Meat.setText(B.getText());
		m=1;
	}
	public void ChooseChicken() {
		Meat.setText(C.getText());
		m=2;
	}
	public void ChoosePork() {
		Meat.setText(P.getText());
		m=3;
	}
	public void Produce() {
		if(b==0) {
			MInfo.setText("请选择品牌！！");;
			return;
		}
		else if(m==0) {
			MInfo.setText("请选择肉类！！");;
			return;
		}
		else if(b==1) {
			Aonong F=new Aonong();
			brand=F.getBrand();
			if(m==1) {
				meat=F.getBeef().getMeatInfo();
			}
			else if(m==2) {
				meat=F.getChicken().getMeatInfo();
			}
			else {
				meat=F.getPork().getMeatInfo();
			}
		}
		else if(b==2) {
			Tianbang F=new Tianbang();
			brand=F.getBrand();
			if(m==1) {
				meat=F.getBeef().getMeatInfo();
			}
			else if(m==2) {
				meat=F.getChicken().getMeatInfo();
			}
			else {
				meat=F.getPork().getMeatInfo();
			}
		}
		else {
			Wens F=new Wens();
			brand=F.getBrand();
			if(m==1) {
				meat=F.getBeef().getMeatInfo();
			}
			else if(m==2) {
				meat=F.getChicken().getMeatInfo();
			}
			else {
				meat=F.getPork().getMeatInfo();
			}
		}
		MInfo.setText("Brand:"+'\n'+brand+'\n'+'\n'+"Meat:"+'\n'+meat);
	}

}
